home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Moscow ML 1.31 / source code / mosml / src / runtime / stacks.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-03  |  1.1 KB  |  60 lines  |  [TEXT/R*ch]

  1. /* structure of the stacks */
  2.  
  3. #ifndef _stacks_
  4. #define _stacks_
  5.  
  6.  
  7. #include "misc.h"
  8. #include "mlvalues.h"
  9. #include "memory.h"
  10.  
  11. /* 1- Argument stack : (value | mark)*  */
  12.  
  13. #define MARK ((value) 0)
  14.  
  15. /* 2- Return stack (return addresses and environment cache)
  16.       A sequence of :
  17.  
  18.    High addresses            OR
  19.  
  20.     N values                N values
  21.     return_frame with cache_size = N    trap_frame with cache_size=N+2
  22.         ...
  23.    Low addresses
  24. */
  25.  
  26. struct return_frame {
  27.   code_t pc;
  28.   value env;
  29.   int cache_size;
  30. /*value cache[cache_size]; */
  31. };
  32.  
  33. struct trap_frame {
  34.   code_t pc;
  35.   value env;
  36.   int cache_size;
  37.   value * asp;
  38.   struct trap_frame * tp;
  39. /*value cache[cache_size]; */
  40. };
  41.  
  42. extern value * arg_stack_low;
  43. extern value * arg_stack_high;
  44. extern value * arg_stack_threshold;
  45. extern value * ret_stack_low;
  46. extern value * ret_stack_high;
  47. extern value * ret_stack_threshold;
  48. extern value * extern_asp;
  49. extern value * extern_rsp;
  50. extern struct trap_frame * tp;
  51. extern value global_data;
  52.  
  53. void reset_roots P((void));
  54. void init_stacks P((void));
  55. void realloc_stacks P((void));
  56.  
  57.  
  58. #endif /* _stacks_ */
  59.  
  60.